
var keyArr = new Array();
// var keyExArr = new Array();

// 将 showPapers.php 查询的结果中的key和keyEx保存在2个数组里面
function keyArray( count_, key_, keyEx_ )
{
	var count,key, keyEx;
	count	= count_;
	key 	= key_;
	keyEx	= keyEx_;
	
	keyArr[count*2-1]	= key;
	keyArr[count*2] = keyEx;
	//document.write (keyArr[count*2]+'<br />');
	//document.write (keyArr[count*2+1]+'<br />');
}

// 清空数组
function free_KeyArray( arr )
{
	var len = arr.length;
	for (i=0; i<len; i++)
	{
		delete arr[i];
	}
	
}

// 随机产生min到max中的一个整数
function randomNum(min, max)
{
	var rand = parseInt(Math.random()*(max-min+1)+min);
	return rand;
};
// 随机产生一个n位的整数
function rndNum(n)
{  
	var rnd="";  
	for(var i=0;i<n;i++)  
	rnd += Math.floor(Math.random()*10); 
	return rnd;  
};
// 随机产生长度为count的字符串
function randomStr(count)
{
	var str = "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz";
	var sstr = "";
	var len = str.length
	for(i=0; i<count; i++)
	{
		var num = randomNum(0,len);
		var strCh = str.charAt(num);
		sstr = sstr + strCh;
		document.write ('len='+len+' i='+i+' num='+num+' strCh='+strCh+' sstr='+sstr+'<br />');
	}
	if (sstr.length!=count)
	{
	
	}
	else
	{
		document.write('len='+sstr.length);
		document.write(' char='+sstr);	
		document.write(' leng='+sstr.length);
		var j = count - sstr.length;
		var m = "";
		for(k=0; k<j; k++)
		{
			var m = randomNum(0,len);
			sstr += str.charAt(m);		
		}
		return sstr;
	}
};
// 随机字符 测试 函数
function randomChar(count)
{
	var str = "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz";
	var sstr = "";
	var len = str.length
	for(i=0; i<count; i++)
	{
		var num = randomNum(0,len-1);
		var strCh = str.charAt(num);
		for(j=0; j<500; j++)
		{
					
		}
		sstr = sstr + strCh;
		if (sstr.length==(i+1))
		{
			document.write ('len='+len+' i='+i+' num='+num+' strCh='+strCh+' sstr='+sstr+'<br />');
		}
		else
		{
			document.write ('<br />'+'Error!'+' sstr.length='+sstr.length+' sstr='+sstr);		
		}
	}
	return sstr;
}

